package com.shuke.medical.insure.eums;

import java.io.Serializable;

/***
 * @title RetEnum
 * @description
 * @author baiji
 * @version 1.0.0
 * @create 2023/9/1 14:41
 **/
public enum RetEnum implements IResultCode, Serializable {
    SUCCESS(200, "成功"),
    OVER_LOAD(201, "系统开小差了，请稍后重试"),
    NO_DATA(202, "暂无数据"),
    NO_LIST_DATA(202, "暂无数据"),
    FAIL_BACK(203, "系统开小差了，请稍后重试"),
    FAIL(204, "操作失败"),
    RECORD_EXIST(205, "记录已存在"),
    ERROR_REQUEST(400, "错误请求"),
    UNAUTHORIZED(401, "未授权"),
    FORBIDDEN(403, "禁止访问"),
    NOT_FOUND(404, "请求地址不存在"),
    METHOD_NOT_ALLOWED(405, "不允许的请求方式"),
    REQUEST_TIME_OUT(408, "请求超时"),
    SYSTEM_MAINTAIN(409, "系统维护中"),
    REQUEST_LIMIT(421, "当前请求量过大，请稍后重试"),
    CONNECTION_LIMIT(429, "当前连接数过大，请稍后重试"),
    MISSING_PARAMS(300, "请求参数不完整"),
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    CONNECTION_TIMEOUT(501, "连接超时"),
    BAD_GATEWAY(502, "网关错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    GATEWAY_TIME_OUT(504, "网关超时"),
    NO_SERVICE(505, "服务已中止"),
    UNKONWN_ERROR(506, "未知错误"),
    PARAM_ILLEGAL(700, "参数不合法"),
    API_LIMIT(1007, "重复提交数据"),
    NO_PERMISSION(1010, "无权限操作"),
    PARAMS_ERROR(1011, "请求参数异常"),
    ROLLBACK_DB(999, "数据回滚"),
    ERROR_TO_SUCCESS(888, "自定义正常");

    private Integer code;
    private String msg;

    private RetEnum(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getMsg() {
        return this.msg;
    }

    @Override
    public String toString() {
        return "{\"code\":\"" + this.code + '"' + ", \"msg\":\"" + this.msg + '"' + '}';
    }

    public static RetEnum getValue(String code) {
        RetEnum[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            RetEnum value = var1[var3];
            if (value.getCode().equals(code)) {
                return value;
            }
        }

        return FAIL;
    }

    private RetEnum() {
    }
}
